
var imgs = ['bg.jpg','xinfeng_hs.png','card_txt.png','hz_body.png','hz_head.png',
			'logo.png','p5_bg_1.jpg','p5_bg_2.png','p5_btn_1.png','p5_btn_2.png',
			'p5_ico1.png','p5_ico2.png','p5_ico3.png','p5_ico4.png','p5_start.png',
			'p5_tree_1.png','p5_tree_2.png','p5_tree_3.png','p5_txt_1.png','p5_txt_2.png','tree_0.png','tree_1.png',
			'p5_tree_1_1.png','p5_tree_1_2.png','p5_tree_1_3.png',
			'p5_tree_2_1.png','p5_tree_2_2.png','p5_tree_2_3.png',
			'p5_tree_3_1.png','p5_tree_3_2.png','p5_tree_3_3.png',
			'tree_2.png','tree_3.png','share.png'];

$(function() { 
	loadimg();
	$('body').on('touchmove',function(event){ event.preventDefault(); });
});

var imgObgList = [];
function loadimg(){
	var c = 0;
	var t = imgs.length;
	for (var im in imgs) {
		var timg = new Image();
		timg.onload = function(){
			c++;
			var per = parseInt(100*c/t);
			$('#per').text(per+'%');
			if(per==100){
				main();
				$('#loading').fadeOut();
			}
		}
		timg.src = 'img/'+imgs[im];//+'?t='+new Date().getMilliseconds();
	}
	$('.page1').hide();
}
 

function main(){
	
	setTimeout(function(){ $('.sn1').addClass('snmv'); },0);
	setTimeout(function(){ $('.sn2').addClass('snmv'); },1000);
	setTimeout(function(){ $('.sn3').addClass('snmv'); },2000);
	setTimeout(function(){ $('.sn4').addClass('snmv'); },3000);
	
	setTimeout(function(){ $('.p5mv_1').addClass('mv'); },1000*Math.random());
	setTimeout(function(){ $('.p5mv_2').addClass('mv'); },1000*(Math.random()+0.4));
	setTimeout(function(){ $('.p5mv_3').addClass('mv'); },1000*(Math.random()+0.8));
	setTimeout(function(){ $('.p5mv_4').addClass('mv'); },1000*(Math.random()+1.2));
	
	$('.xf_zi').addClass('xf_zi_mv');
	
	$('.xinfeng').bind('touchstart',function(ev){
		ev.preventDefault();
		$('.hz').fadeOut(); 
		$('.xf_zi').fadeOut(); 
		$('.xinfeng').addClass('xfmv'); 
		setTimeout(function(){ $('.page_view').fadeOut(); $('.page_set').css('opacity',1).fadeIn(); },1000);
	});
	
	$('.p5_btn').click(function(){
		location.href = 'index.php';
	});
	
}
